package job.job_0819;

import java.util.Scanner;
public class Factorial {
    public static void main(String[] args) {
        int sum=0;
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        //System.out.println(factorial(n));

        //求1！+2！+3！+4！+........+n!的和
        for(int i=1;i<=n;i++){
            sum+=factorial(i);
        }
        System.out.println(sum);
    }
    public static int factorial(int n){//求 N 的阶乘
        int mul=1;
        for(int i=1;i<=n;i++){
            mul*=i;
        }
        return mul;
    }
}
